(*Defineparameters*)rsah=10;rsas=-2;rses=0;rhch=3;rhcs=-2;rhds=-2;rhbh=1;a=0.1;b=0.2;g=0.8;(*Definetheequationsasfunctions*)vsEq[vs_,vh_]:=Max[a*(rsas+g*vs)+(1-a)*(rsah+g*vh),rses+g*vs]vhEq[vs_,vh_]:=Max[b*(rhch+g*vh)+(1-b)*(rhcs+g*vs),rhbh+g*vh,rhds+g*vs](*SolvethesystemusingFindRootwithinitialguessesforv_hand\v_l*)solution=FindRoot[{vs==vsEq[vs,vh],vh==vhEq[vs,vh]},{{vh,0},{vs,0}}];(*PrinttheoptimalactionatstateS.1representstheactionaand\2representstheactione*)Ordering[{a*(rsas+g*vs)+(1-a)*(rsah+g*vh),rses+g*vs}/.solution,-1](*Printtheoptimalactionatstateh.1representstheactionc,and\2representstheactionb,and3representstheactiond*)Ordering[{b*(rhch+g*vh)+(1-b)*(rhcs+g*vs),rhbh+g*vh,rhds+g*vs}/.solution,-1]
Out[]=
{1}
Out[]=
{3}